export const getToken = function () {
    if(localStorage.getItem("userInfo")){
        return JSON.parse(localStorage.getItem("userInfo")).token
    }
    else return null
}

export const getUserInfo = function () {
    if(localStorage.getItem("userInfo")){
        return JSON.parse(localStorage.getItem("userInfo"))
    }
    else return null
}

export function StringToDate(s) {
    var d = new Date();
    d.setYear(parseInt(s.substring(0,4),10));
    d.setMonth(parseInt(s.substring(5,7)-1,10));
    d.setDate(parseInt(s.substring(8,10),10));
    d.setHours(parseInt(s.substring(11,13),10));
    d.setMinutes(parseInt(s.substring(14,16),10));
    d.setSeconds(parseInt(s.substring(17,19),10));
    return d;
}